<?php

/**
 *    物流控制器
 *
 *    @author    Garbin
 *    @usage    none
 */
class Stat_statisticsApp extends BackendApp
{
    /**
     *    物流统计
     *
     *    @author    Garbin
     *    @return    void
     */

    function index()
    {
        $this->assign('admin', $this->visitor->get());

        $ms =& ms();
        //$this->assign('new', $ms->pm->check_new($this->visitor->get('user_id')));

        $order_mod =& m('order');
        $refund = &m('refund');

        $order_all    = $order_mod->getOne("SELECT count(*) FROM " . DB_PREFIX . "order WHERE status IN (20)");//未发货
        $order_undue  = $order_mod->getOne("SELECT count(*) FROM " . DB_PREFIX . "order WHERE status IN (30)");//已发货
        $order_undued = $order_mod->getOne("SELECT count(*) FROM " . DB_PREFIX . "order WHERE status IN (40)");//已收货

        $refund_agree = $refund->getOne("SELECT count(*) FROM " . DB_PREFIX ."refund WHERE status = 'WAIT_ADMIN_AGREE'");
        $refund_dreee = $refund->getOne("SELECT count(*) FROM " . DB_PREFIX ."refund WHERE status IN ('WAIT_SELLER_CONFIRM,DELIVERY')");

        $stat = array(
            'order_all' => $order_all,
            'order_undue' => $order_undue,
            'order_undued' => $order_undued,
            'refund_agree' => $refund_agree,
            'refund_dreee' => $refund_dreee
        );
        $this->assign('revenue', $stat);

        $this->display('stat_statistics.html');
    }

}
?>
